package com.teach;

import com.teach.R;
import com.teach.downclass.student.StudentDownClassActivity;
import com.teach.onclass.student.StudentUpClassActivity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class StudentMainActivity extends Activity {

	public static boolean isOnClass;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_studentmain);

		Button up = (Button) findViewById(R.id.student_up_class);
		UpButtonListener upbl = new UpButtonListener();
		up.setOnClickListener(upbl);

		Button down = (Button) findViewById(R.id.student_down_class);
		DownButtonListener downbl = new DownButtonListener();
		down.setOnClickListener(downbl);

	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

	class UpButtonListener implements OnClickListener {

		@Override
		public void onClick(View v) {
			StudentMainActivity.isOnClass = true;
			Intent upClassIntent = new Intent();
			upClassIntent.setClass(StudentMainActivity.this,
					StudentUpClassActivity.class);
			startActivity(upClassIntent);
		}

	}

	class DownButtonListener implements OnClickListener {

		@Override
		public void onClick(View v) {
			StudentMainActivity.isOnClass = false;
			Intent downClassIntent = new Intent();
			downClassIntent.setClass(StudentMainActivity.this,
					StudentDownClassActivity.class);
			startActivity(downClassIntent);
		}
	}
}
